package com.liao.badminton.dto;

import com.liao.badminton.code.BaseField;
import com.liao.badminton.code.validation.Delete;
import com.liao.badminton.code.validation.Insert;
import com.liao.badminton.code.validation.Update;
import io.swagger.annotations.ApiModelProperty;
import com.liao.badminton.entity.SystemUserRole;
import javax.validation.constraints.NotNull;
import java.util.List;
import lombok.Data;
import com.liao.badminton.code.validation.FindDetail;
import java.util.Date;

/**
* @author liaocheng
* @date 2024-11-01
* description:用户和角色关联表
*/
@Data
public class SystemUserRoleDto extends BaseField {

    @ApiModelProperty(value = "自增编号")
    @NotNull(message = "主键id不能为空",groups = {Update.class, FindDetail.class})
    private Long id;

    @ApiModelProperty(value = "用户ID")
    private Long userId;

    @ApiModelProperty(value = "角色ID")
    private Long roleId;

    @NotNull(message = "主键id不能为空",groups = {Delete.class})
    private List<Long> delIds;  //批量删除ids

    public SystemUserRole invertEntity(){
        SystemUserRole dto = new SystemUserRole();
        BaseField.invert(this, dto);
        dto.setId(this.getId());
        dto.setUserId(this.getUserId());
        dto.setRoleId(this.getRoleId());
        return dto;
    }
}
